package com.music.controller;

import com.music.dto.Result;
import com.music.entity.UserLikeVo;
import com.music.service.CountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/count")
public class CountController {
    @Autowired
    private CountService countService;
    @RequestMapping("/songList")
    public Result doFindSongListCount(){
        Result result=new Result();
        List<UserLikeVo> list=countService.songListCount();
        if(!list.isEmpty()){
            result.ok(list);
        }else{
            result.fail(0,"没有相关数据");
        }
        return result;
    }
    @RequestMapping("/song")
    public Result doFindSongCount(){
        Result result=new Result();
        List<UserLikeVo> list=countService.songCount();
        if(!list.isEmpty()){
            result.ok(list);
        }else{
            result.fail(0,"没有相关数据");
        }
        return result;
    }
    @RequestMapping("/album")
    public Result doFindAlbumCount(){
        Result result=new Result();
        List<UserLikeVo> list=countService.albumCount();
        if(!list.isEmpty()){
            result.ok(list);
        }else{
            result.fail(0,"没有相关数据");
        }
        return result;
    }
    @RequestMapping("/mv")
    public Result doFindMvCount(){
        Result result=new Result();
        List<UserLikeVo> list=countService.mvCount();
        if(!list.isEmpty()){
            result.ok(list);
        }else{
            result.fail(0,"没有相关数据");
        }
        return result;
    }
}
